//
//  CustomImageGridView.m
//  ClassifyShop
//
//  Created by yuyao on 15/3/22.
//  Copyright (c) 2015年 yuyao. All rights reserved.
//

#import "CustomImageGridView.h"
#import "GUIDefine.h"
@implementation CustomImageGridView


- (void)setDatas:(NSArray *)images{
    
    int width = (kAppScreenWidth-30)/2;
    
    UIImageView *imageV;
    CGRect frame;
    for (int i= 0; i<images.count; i++) {
        
        
        imageV = [UIImageView new];
        
        imageV.tag = 100+i;
        
        frame.size.width = width;//设置按钮坐标及大小
        frame.size.height = width;
        frame.origin.x = (i%2)*(width+10)+10;
        frame.origin.y = floor(i/2)*(width+10)+10;
        
        [imageV setFrame:frame];
        [imageV setImageWithURL:[NSURL URLWithString:[images objectAtIndex:i]]];
        
        [self addSubview:imageV];
        
    }
    [self setFrame:CGRectMake(0, 0, kAppScreenWidth,floor((images.count-1)/2)*(width+10)+width+10)];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
